<template>
  <j-modal
    destroyOnClose
    :width="1200"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
    :fullscreen="false"
    :footer="null"
    title="办理情况"
    @ok="handleOk"
    @cancel="handleCancel"
  >
    <a-card :bordered="false" :loading="loading">
      <detail-list size="large" title="">
        <detail-list-item term="企业名称"> {{ result.enterpriseName }}</detail-list-item>
        <detail-list-item term="信用代码"> {{ result.enterpriseCode }}</detail-list-item>
        <detail-list-item term="经办人姓名"> {{ result.agentName }}</detail-list-item>
        <detail-list-item term="经办人手机号"> {{ result.agentPhone }}</detail-list-item>
      </detail-list>
       <a-divider style="margin: 16px 0" />
      <detail-list title=""  size="large">
        <detail-list-item term="保证金（元）"> {{ result.tenderBond }}</detail-list-item>
        <detail-list-item term="保函编号"> {{ result.guaranteeNo }}</detail-list-item>
        <detail-list-item term="状态">  {{ result.approveStatus == '1' ? '完成' : result.approveStatus == '2' ? '驳回' : result.approveStatus == '0' ? '办理中' : '未知状态' }}</detail-list-item>
        <detail-list-item term="保函">
             <a-button
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(result.guaranteeUrl)">
            下载
          </a-button> </detail-list-item>
       <!--  <detail-list-item term="该数据更新时间">2018-08-08</detail-list-item>
        <detail-list-item >&nbsp;</detail-list-item> -->
      </detail-list>
    </a-card>
  </j-modal>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { postAction, getAction } from '@api/manage'
import DetailList from '@/components/tools/DetailList'

const DetailListItem = DetailList.Item

export default {
  name: 'ScheduleDetail',
  components: {
    DetailList,
    DetailListItem,
  },
  data() {
    return {
      description: '办理情况',
      labelCol: {
        xs: { span: 24 },
        sm: { span: 4 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      dictOptions: {},
      superFieldList: [],
      visible: false,
      sectionInfo: {},
      disableMixinCreated: false,
      url: {
        getBySectionId: '/tender/guarantee/getBySectionId',
      },
      loading: false,
      result: {},
    }
  },
  created() {},
  computed: {},
  methods: {
    handleOk() {
      this.visible = false
    },
    handleCancel() {
      this.visible = false
    },
    show(sectionId) {
      this.result = {}
      this.loading = true
      var params = { sectionId: sectionId }
      getAction(this.url.getBySectionId, params)
        .then((res) => {
          if (res.success) {
            if(res.result!=null){
              this.visible = true
              this.result = res.result
            }else{
            this.$message.warning("没有找到对应的投标记录")
            }
          } else {
            this.$message.warning(res.message)
          }
        })
        .finally(() => {
          this.loading = false
        })
    },
    getApprovestatus(status) {
      var text = '办理中'
      switch (status) {
        case '0':
          text = '已办理'
          break
        case '1':
          text = '完成'
          break
        case '2':
          text = '驳回'
          break

        default:
          break
      }
      return text
    },
    downloadFile(fileUrl){
      if(!fileUrl){
        this.$message.warning("未知的文件")
        return;
      }
      window.open(fileUrl,'_blank');
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
